Ubuntu 14.04
Sponsored Link

Squid + SquidClamav
2014/06/08
 
Install SquidClamav and Configure Proxy Server to scan downloaded files to protect from virus. Install Clamav first.
[1] Install Clamd
root@prox:~#
apt-get -y install clamav-daemon
[2] Download the latest version of Squidclamav from the link below.
http://sourceforge.net/projects/squidclamav/files/squidclamav/
# install some required packages first

root@prox:~#
apt-get -y install gcc make curl libcurl4-gnutls-dev c-icap libicapapi-dev
root@prox:~#
wget http://ftp.jaist.ac.jp/pub/sourceforge/s/project/sq/squidclamav/squidclamav/6.11/squidclamav-6.11.tar.gz

root@prox:~#
tar zxvf squidclamav-6.11.tar.gz

root@prox:~#
cd squidclamav-6.11

root@prox:~/squidclamav-6.11#
./configure --with-c-icap

root@prox:~/squidclamav-6.11#
root@prox:~/squidclamav-6.11#
make install

root@prox:~/squidclamav-6.11#
root@prox:~#
ln -s /etc/c-icap/squidclamav.conf /etc/squidclamav.conf

root@prox:~#
vi /etc/squidclamav.conf
# line 17: change ( create a error page that is redirected to )

redirect
http://www.srv.world/error.html
[3] Configure c-icap and Squid
root@prox:~#
vi /etc/default/c-icap
# line 6: change

START=
yes
root@prox:~#
vi /etc/c-icap/c-icap.conf
# line 142: change to the admin email

ServerAdmin
root@srv.world
# line 151: change to the hostname

ServerName
prox.srv.world
# line 502: add

Service squidclamav squidclamav.so
root@prox:~#
/etc/init.d/c-icap start

Starting c-icap: c-icap.
root@prox:~#
vi /etc/squid3/squid.conf
# line 6078: add

icap_enable on
# line 6199: add

adaptation_send_client_ip on
# line 6209: add

adaptation_send_username on
# line 6214: add

icap_client_username_header X-Authenticated-User
# line 6310: add follows

icap_service service_req reqmod_precache bypass=1 icap://127.0.0.1:1344/squidclamav
adaptation_access service_req allow all
icap_service service_resp respmod_precache bypass=1 icap://127.0.0.1:1344/squidclamav
adaptation_access service_resp allow all
root@prox:~#
initctl restart squid3

squid3 start/running, process 12010
[4] Try to access to the page that has trial virus below.
http://downloadcenter.trendmicro.com/index.php?regs=jp&prodid=1424 Click 'eicar.com' and try to download it. Then, Virus will be detected and accessing is redirected to the page you set.
 
Tweet